package cn.jizi.bshisy.service.impl;

import cn.jizi.bshisy.entity.InDoctor;
import cn.jizi.bshisy.mapper.InDoctorMapper;
import cn.jizi.bshisy.service.InDoctorService;
import cn.jizi.bshisy.tool.ShuiJi;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class InDoctorServiceImpl implements InDoctorService {
    @Resource
    private InDoctorMapper inDoctorMapper;
    @Override
    public int getAddInDoctor(InDoctor inDoctor) {
        inDoctor.setInno(ShuiJi.random());//生成随机住院医师号
        return inDoctorMapper.getAddInDoctor(inDoctor);
    }

    @Override
    public List<InDoctor> getInNameInDoctorListPage(String inname, Integer currentPageNo, Integer pageSize) {
        // 计算起始位置
        currentPageNo = (currentPageNo - 1) * pageSize;
        return inDoctorMapper.getInNameInDoctorListPage(inname, currentPageNo, pageSize);
    }

    @Override
    public int getInNameInDoctorListCount(String inname) {
        return inDoctorMapper.getInNameInDoctorListCount(inname);
    }
}
